package com.aldd.controller;

import com.aldd.entity.Dept;
import com.aldd.service.DeptService;
import lombok.Data;

import java.util.List;
@Data
public class DeptController {
    private DeptService deptService;

    //查询全部
    public List<Dept> selectAllDept() {
        return deptService.selectAllDept();
    }

    //根据id查询
    public Dept selectDeptById(int id) {
        return deptService.selectDeptById(id);
    }

    //根据id删除
    public String deleteDeptById(int id) {
        return deptService.deleteDeptById(id) ? "删除成功" : "删除失败";
    }

    //添加
    public void insertDept(Dept dept) {
        deptService.insertDept(dept);
    }

    //修改
    public void updateDept(Dept dept) {
        deptService.updateDept(dept);
    }
}
